/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package market_db;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author nik
 */
@Entity
@Table(name = "CHECKS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Checks.findAll", query = "SELECT c FROM Checks c"),
    @NamedQuery(name = "Checks.findByCheckId", query = "SELECT c FROM Checks c WHERE c.checkId = :checkId"),
    @NamedQuery(name = "Checks.findByAvailable", query = "SELECT c FROM Checks c WHERE c.available = :available")})
public class Checks implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "CHECK_ID")
    private Integer checkId;
    @Column(name = "AVAILABLE")
    private Serializable available;
    @JoinColumn(name = "CUSTOMER_ID", referencedColumnName = "CUSTOMER_ID")
    @ManyToOne
    private Customer customerId;

    public Checks() {
    }

    public Checks(Integer checkId) {
        this.checkId = checkId;
    }

    public Integer getCheckId() {
        return checkId;
    }

    public void setCheckId(Integer checkId) {
        this.checkId = checkId;
    }

    public Serializable getAvailable() {
        return available;
    }

    public void setAvailable(Serializable available) {
        this.available = available;
    }

    public Customer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Customer customerId) {
        this.customerId = customerId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (checkId != null ? checkId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Checks)) {
            return false;
        }
        Checks other = (Checks) object;
        if ((this.checkId == null && other.checkId != null) || (this.checkId != null && !this.checkId.equals(other.checkId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "market_db.Checks[ checkId=" + checkId + " ]";
    }
    
}
